package com.liws.hellopoi.controller;

import com.liws.hellopoi.util.ImportExcelUtil;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;

/**
 * @Author: liweisheng
 * @Dcscription: poi 框架的导入
 * @Date: 2021/11/16 15:09
 */
@RestController
@RequestMapping("/")
public class ImportExcelController {


    @RequestMapping(value = "/import",method = RequestMethod.POST)
    public List<List<Object>> uploadadd(@RequestParam("file") MultipartFile file) throws IOException {
        ImportExcelUtil importExcelUtil = new ImportExcelUtil();
        List<List<Object>> bankListByExcel=null;
        try {
            bankListByExcel = importExcelUtil.getBankListByExcel(file.getInputStream(), file.getOriginalFilename());

            System.out.println("测试--"+bankListByExcel);
        } catch (Exception e) {
            e.printStackTrace();
        }

        return bankListByExcel;
    }
}
